package cn.iocoder.yudao.module.team.dal.mysql.ledger;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.team.dal.dataobject.ledger.LedgerDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.team.controller.admin.ledger.vo.*;

/**
 * 报账管理 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface LedgerMapper extends BaseMapperX<LedgerDO> {

    default PageResult<LedgerDO> selectPage(LedgerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LedgerDO>()
                .betweenIfPresent(LedgerDO::getEnterDate, reqVO.getEnterDate())
                .likeIfPresent(LedgerDO::getEnterName, reqVO.getEnterName())
                .eqIfPresent(LedgerDO::getEnterPhone, reqVO.getEnterPhone())
                .eqIfPresent(LedgerDO::getType, reqVO.getType())
                .likeIfPresent(LedgerDO::getProductName, reqVO.getProductName())
                .eqIfPresent(LedgerDO::getUnitPrice, reqVO.getUnitPrice())
                .eqIfPresent(LedgerDO::getMoney, reqVO.getMoney())
                .eqIfPresent(LedgerDO::getApprovalStatus, reqVO.getApprovalStatus())
                .likeIfPresent(LedgerDO::getApprovalName, reqVO.getApprovalName())
                .eqIfPresent(LedgerDO::getApprovalRemarks, reqVO.getApprovalRemarks())
                .eqIfPresent(LedgerDO::getUrl, reqVO.getUrl())
                .eqIfPresent(LedgerDO::getRemarks, reqVO.getRemarks())
                .eqIfPresent(LedgerDO::getColumn1, reqVO.getColumn1())
                .eqIfPresent(LedgerDO::getColumn2, reqVO.getColumn2())
                .eqIfPresent(LedgerDO::getColumn3, reqVO.getColumn3())
                .eqIfPresent(LedgerDO::getColumn4, reqVO.getColumn4())
                .eqIfPresent(LedgerDO::getColumn5, reqVO.getColumn5())
                .eqIfPresent(LedgerDO::getColumn6, reqVO.getColumn6())
                .betweenIfPresent(LedgerDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LedgerDO::getId));
    }

}